package com.gaohe;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

public class Demo {
    public static void main(String[] args) {
        FastAutoGenerator.create(
                        "jdbc:mysql://localhost:3306/mp_db2",   //数据库路径
                        "root", //用户名
                        "1234") //密码
                .globalConfig(builder -> builder
                        .author("小帅") //作者
                        .outputDir("D://code") //文件位置
                        .commentDate("yyyy-MM-dd") //时间格式
                )
                .packageConfig(builder -> builder
                        .parent("com.gaohe")//父包
                        .entity("pojo") //实体类包
                        .mapper("mapper")//持久层包
                        .service("service") //业务层包
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok() //使用 lombok
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
